package services;

import Dao.RolesDao;
import entity.RolesBean;

import java.util.List;

public class RolesServiceAll {
    private RolesDao rolesDao = new RolesDao();
//    查全部
    public List<RolesBean> all(){ return rolesDao.all(); }
//根据id查询
    public RolesBean one(int id){ return rolesDao.one(id); }

    public RolesBean getRoleDataByUserId(int uid){ return  rolesDao.getRoleDataByUserId(uid); }
//根据名字查询
    public int getRoleIdByRoleName(String radioRolesCheckedName){ return rolesDao.getRoleIdByRoleName(radioRolesCheckedName); }
//添加职位
    public int add(RolesBean permission){
        if(permission == null){
            throw new RuntimeException("用户对象为空");
        }
        return rolesDao.add(permission);
    }

    public int dele(String rName){return rolesDao.del(rName);}
}
